package com.example.demo.enums;

import com.zhucan.enums.core.enums.CodeEnum;
import com.zhucan.enums.conversion.annotation.EnumAutoConverter;
import com.zhucan.enums.scanner.annotation.EnumScan;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单类型枚举
 */
@Getter
@AllArgsConstructor
@EnumScan(
    description = "订单类型",
    defaultEnumCode = 1,
    category = "Order"
)
@EnumAutoConverter
public enum OrderTypeEnum implements CodeEnum {
    
    /**
     * 普通订单
     */
    NORMAL(1, "普通订单"),
    
    /**
     * 预售订单
     */
    PRE_SALE(2, "预售订单"),
    
    /**
     * 团购订单
     */
    GROUP_BUYING(3, "团购订单"),
    
    /**
     * 秒杀订单
     */
    FLASH_SALE(4, "秒杀订单"),
    
    /**
     * 礼品订单
     */
    GIFT(5, "礼品订单");

    private final Integer code;
    private final String name;

    @Override
    public Integer code() {
        return this.code;
    }

    @Override
    public String value() {
        return this.name;
    }
    
    /**
     * 是否为特殊订单类型
     */
    public boolean isSpecialType() {
        return this != NORMAL;
    }
}
